package com.jwthhealth_pub.old.acupressure.view.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jwthhealth_pub.R;
import com.jwthhealth_pub.old.acupressure.module.AcupressureJztzjldetailModule;
import com.jwthhealth_pub.old.acupressure.view.NineConstitutionActivity;

import java.util.List;

/**
 * Created by Administrator on 2017/1/13.
 */
public class NineConstitutionMainDescAdapter extends RecyclerView.Adapter {

    private NineConstitutionActivity activity;
    List<AcupressureJztzjldetailModule.DataBean.MainDescBean> data;

    public NineConstitutionMainDescAdapter(NineConstitutionActivity nineConstitution, List<AcupressureJztzjldetailModule.DataBean.MainDescBean> data) {
        this.activity = nineConstitution;
        this.data = data;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(activity, R.layout.item_nineconstitution, null);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {

        ViewHolder viewHolder = (ViewHolder) holder;
        AcupressureJztzjldetailModule.DataBean.MainDescBean mainDescBean = data.get(position);

        viewHolder.name.setText(mainDescBean.getName());
        viewHolder.desc.setText(mainDescBean.getDesc());
    }

    @Override
    public int getItemCount() {
        return data.size();
    }

    class ViewHolder extends RecyclerView.ViewHolder{

        TextView name, desc;

        public ViewHolder(View itemView) {
            super(itemView);
            name = (TextView) itemView.findViewById(R.id.name);
            desc = (TextView) itemView.findViewById(R.id.desc);
        }
    }
}
